package com.huwei.util.cryption;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import com.huwei.util.cryption.JWTTokenUtil.JWTTokenUtilBuilder;

import lombok.Data;
@Data
@Component
@PropertySource(value="classpath:config/properties/pro-jwt.properties")
public class JWT {
	/*
	 * 过期时间
	 */
	@Value("${jwt.token.exp.time}")
	private Long tokenExpTime;
	/*
	 * 宽限时间，即最终过期时间
	 */
	@Value("${jwt.token.gra.time}")
	private Long tokeGraTime;
	/*
	 * token 签发主体
	 */
	@Value("${jwt.issuser}")
	private String issuser;
	/*
	 * jwt的接受对象
	 */
	@Value("${jwt.audience}")
	private String audience;
	/**
	 * 加密公私
	 */
	@Value("${jwt.secret}")
	private String secret;
	
	public JWTTokenUtil jwtTokenUtil() {
		return JWTTokenUtilBuilder.build(new AuthenConstants(tokenExpTime, tokeGraTime, issuser, audience));
	}
}
